package com.class05.method_more._03valuetransfer;

/**
 * @ClassDescription:
 * @JdkVersion: 17
 * @Author: yxy
 * @Created: 2024/3/28 8:10
 */
public class ValueTransferTest3 {
    public static void main(String[] args) {
        ValueTransferTest3 test = new ValueTransferTest3();
        Data data = new Data();// new Data().var+enter
        data.m = 10;
        data.n = 20;
//        操作1：
//        int temp = data.m;
//        data.m = data.n;
//        data.n = temp;
//        操作2：
        test.swap(data);
        System.out.println(data.m);

    }

    public void swap(Data data) {
        int temp = data.m;
        data.m = data.n;
        data.n = temp;
    }


}

class Data {
    int m;
    int n;
}
